﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Windows.Media;
using System.Windows.Media.Media3D;

namespace GameBoard
{
    [KnownType(typeof(ConeVisualData))]
    [KnownType(typeof(CubeVisualData))]
    [KnownType(typeof(MapExentionVisualData))]
    [KnownType(typeof(SphereVisualData))]
    [KnownType(typeof(ObjectVisualData))]
    [KnownType(typeof(TubeVisualData))]
    [DataContract]
    public abstract class BaseTerrainData : BaseVisualData
    {
        public abstract Point3D CenterOfTerrainFeature { get; }
        public abstract String ItemDescription { get; }
        public abstract Double ZoomHeight { get; }
        
        [DataMember]
        public bool IsNotSolid { get; set; }
        [DataMember]
        public bool IsTransparent { get; set; }

        public virtual Material Material
        {
            get
            {
                MaterialBrush = null;
                if (!string.IsNullOrWhiteSpace(MaterialFile))
                {
                    if (File.Exists(MaterialFile))
                    {
                        MaterialBrush = MaterialMaker.MakeImageMaterial(MaterialFile);

                    }
                }
                if (MaterialBrush == null)
                {
                    MaterialBrush = new SolidColorBrush(MaterialColor);

                }
                return new DiffuseMaterial(MaterialBrush);
            }
        }
    }
}
